import request from '@/utils/request'

// 是否使用模拟数据
const useMockData = false;

// 模拟数据
const mockData = [
  // 模拟数据内容保持不变
  // ... existing code ...
]

// 获取维修评价列表
export function listRepairEvaluation(query) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      msg: 'success',
      rows: mockData,
      total: mockData.length
    });
  }
  return request({
    url: '/qep/repair-evaluation/list',
    method: 'get',
    params: query
  })
}

// 查询维修评价详细
export function getRepairEvaluation(id) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      data: mockData.find(item => item.id === id)
    });
  }
  return request({
    url: '/qep/repair-evaluation/' + id,
    method: 'get'
  })
}

// 根据维修任务ID获取评价
export function getRepairEvaluationByTaskId(repairTaskId) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      data: mockData.find(item => item.repairTaskId === repairTaskId)
    });
  }
  return request({
    url: '/qep/repair-evaluation/task/' + repairTaskId,
    method: 'get'
  })
}

// 新增维修评价
export function addRepairEvaluation(data) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      msg: '添加成功'
    });
  }
  return request({
    url: '/qep/repair-evaluation',
    method: 'post',
    data: data
  })
}

// 修改维修评价
export function updateRepairEvaluation(data) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      msg: '修改成功'
    });
  }
  return request({
    url: '/qep/repair-evaluation',
    method: 'put',
    data: data
  })
}

// 删除维修评价
export function delRepairEvaluation(id) {
  if (useMockData) {
    return Promise.resolve({
      code: 200,
      msg: '删除成功'
    });
  }
  return request({
    url: '/qep/repair-evaluation/' + id,
    method: 'delete'
  })
} 